<template>
    <div>
        <van-nav-bar
        placeholder
  title="搜索"
  left-text="返回"

  left-arrow
  @click-left="onClickLeft"

/>
<van-search v-model="value" @search="search" placeholder="请输入搜索关键词" />
<router-link :to="`/details?id=${item.gid}`" v-for="(item,i) in sea" :key="i">
        <van-card 
  :price=item.gprice
  :desc=item.gjs
  :title=item.gname
  :thumb=item.gimg
/>
</router-link>
    </div>
</template>
<script>
export default {
    data() {
        return {
            sea:'',
            value:'',
            
        }
    },
    methods: {
        onClickLeft(){
            this.$router.back(-1)
        },
        search(val){
    this.axios.get(`/search?val=${val}`).then(result=>{
      this.sea=result.data.results
    console.log(this.sea); })
        }
    },
    mounted() {
        let val=this.$route.query.val;
        
            this.axios.get(`/search?val=${val}`).then(result=>{
      this.sea=result.data.results
    
      
    })

    },
}
</script>
<style scoped>
span{
    color: black;
}
</style>